www.gusucode.com > VC++ 桌面透明数字时钟源码-源码程序 > VC++ 桌面透明数字时钟源码-源码程序/code/SetDlg.cpp
// SetDlg.cpp : implementation file // Download by http://www.NewXing.com #include "stdafx.h" #include "File.h" #include "SetDlg.h" #include "FileDlg.h" #include "File.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CSetDlg dialog CSetDlg::CSetDlg(CWnd* pParent /*=NULL*/) : CDialog(CSetDlg::IDD, pParent) { //{{AFX_DATA_INIT(CSetDlg) m_b = 0; m_g = 0; m_r = 0; m_sec = 0; m_x = 0; m_y = 0; m_font = 0; m_poun = 0; //}}AFX_DATA_INIT } void CSetDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CSetDlg) DDX_Text(pDX, IDC_B, m_b); DDV_MinMaxUInt(pDX, m_b, 0, 255); DDX_Text(pDX, IDC_G, m_g); DDV_MinMaxUInt(pDX, m_g, 0, 255); DDX_Text(pDX, IDC_R, m_r); DDV_MinMaxUInt(pDX, m_r, 0, 255); DDX_Text(pDX, IDC_SEC, m_sec); DDV_MinMaxUInt(pDX, m_sec, 0, 3600); DDX_Text(pDX, IDC_X, m_x); DDV_MinMaxUInt(pDX, m_x, 0, 2400); DDX_Text(pDX, IDC_Y, m_y); DDV_MinMaxUInt(pDX, m_y, 0, 2000); DDX_Text(pDX, IDC_FONT, m_font); DDV_MinMaxUInt(pDX, m_font, 0, 1000); DDX_Text(pDX, IDC_POUND, m_poun); DDV_MinMaxUInt(pDX, m_poun, 0, 10000); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CSetDlg, CDialog) //{{AFX_MSG_MAP(CSetDlg) ON_BN_CLICKED(IDC_OFF, OnOff) ON_BN_CLICKED(IDC_APPLY, OnApply) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CSetDlg message handlers void CSetDlg::OnOff() { ::DestroyWindow(m_hWnd); // TODO: Add your control notification handler code here } void CSetDlg::OnApply() { UpdateData(TRUE); CString strr,strg,strb,strsec,strx,stry,strfont,strpoun; strr.Format("%d",m_r); strg.Format("%d",m_g); strb.Format("%d",m_b); strsec.Format("%d",m_sec); strx.Format("%d",m_x); stry.Format("%d",m_y); strfont.Format("%d",m_font); strpoun.Format("%d",m_poun); ::WritePrivateProfileString("SYSTEM","m_pound",strpoun,".\\setup.ini"); ::WritePrivateProfileString("SYSTEM","m_r",strr,".\\setup.ini"); ::WritePrivateProfileString("SYSTEM","m_g",strg,".\\setup.ini"); ::WritePrivateProfileString("SYSTEM","m_b",strb,".\\setup.ini"); ::WritePrivateProfileString("SYSTEM","m_time",strsec,".\\setup.ini"); ::WritePrivateProfileString("SYSTEM","m_px",strx,".\\setup.ini"); ::WritePrivateProfileString("SYSTEM","m_py",stry,".\\setup.ini"); ::WritePrivateProfileString("SYSTEM","m_font",strfont,".\\setup.ini"); HWND hWnd; hWnd=(HWND)(::FindWindow("MyDialog",NULL)); if(hWnd) { ::SendMessage(hWnd,WM_MYMESSAGE,0,WM_MBUTTONUP); } //CDialog::OnOK(); ::FindWindow("CFileDlg","aaaaa") // TODO: Add your control notification handler code here } BOOL CSetDlg::OnInitDialog() { //CDialog::OnInitDialog(); m_poun=::GetPrivateProfileInt("SYSTEM","m_pound",0,".\\setup.ini"); m_r=::GetPrivateProfileInt("SYSTEM","m_r",0,".\\setup.ini"); m_g=::GetPrivateProfileInt("SYSTEM","m_g",0,".\\setup.ini"); m_b=::GetPrivateProfileInt("SYSTEM","m_b",0,".\\setup.ini"); m_sec=::GetPrivateProfileInt("SYSTEM","m_time",0,".\\setup.ini"); m_x=::GetPrivateProfileInt("SYSTEM","m_px",0,".\\setup.ini"); m_y=::GetPrivateProfileInt("SYSTEM","m_py",0,".\\setup.ini"); m_font=::GetPrivateProfileInt("SYSTEM","m_font",0,".\\setup.ini"); UpdateData(FALSE); ::SetWindowPos(this->GetSafeHwnd(), CWnd::wndTopMost, 500, 300, 0, 0, SWP_NOSIZE); return FALSE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }